package com.alita.redis.utils.time;

import java.util.Date;

public class TimeUtil {

    private TimeUtil(){}



    public static Integer getCurrentHour() {
        String s = DateUtil.formatDate(new Date(), "HH");
        if (s.startsWith("0") && !"00".equals(s)){
            s = s.replace("0", "");
        }
        return Integer.valueOf(s);
    }

    public static Integer getCurrentMinuite() {
        String s = DateUtil.formatDate(new Date(), "mm");
        if (s.startsWith("0") && !"00".equals(s)){
            s = s.replace("0", "");
        }
        return Integer.valueOf(s);
    }

    /**
     * 获取时间 , 如果时间为 12:45 , 返回 12.45
     */
    public static double getCurrentHHmmTime() {
        double hour = TimeUtil.getCurrentHour();
        double minuite = TimeUtil.getCurrentMinuite();
        return hour + minuite / 100;
    }
}